package com.ujs.oss.controller;

import com.ujs.commonutils.constant.R;
import com.ujs.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author zhangshihao
 * @create 2023-08-04 17:10
 */
@RestController
@RequestMapping("/eduoss/fileOss")
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping
    public R uploadOssFile(MultipartFile file) {
        String url = ossService.uploadFileAvator(file);
        return R.ok().data("url", url);
    }
}
